package fr.mathis.tbbtmoments;

import java.util.List;
import java.util.Locale;

import fr.mathis.tbbtmoments.dummy.DummyContent.DummyItem;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;


class CustomAdapter extends ArrayAdapter<DummyItem> {

    int resource;
    String response;
    Context context;
    
    public CustomAdapter(Context context, int resource, List<DummyItem> items) {
        super(context, resource, items);
        this.resource=resource;
 
    }
	@SuppressLint("DefaultLocale")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

        LinearLayout v;
        DummyItem di = getItem(position);
         
        if(convertView==null)
        {
            v = new LinearLayout(getContext());
            String inflater = Context.LAYOUT_INFLATER_SERVICE;
            LayoutInflater vi;
            vi = (LayoutInflater)getContext().getSystemService(inflater);
            vi.inflate(resource, v, true);
        }
        else
        {
            v = (LinearLayout) convertView;
        }
        
        TextView tv1 =(TextView)v.findViewById(R.id.textView1);
        TextView tv2 =(TextView)v.findViewById(R.id.textView2);
        TextView tv3 =(TextView)v.findViewById(R.id.textView3);
         
        tv1.setTypeface(di.tf);
        tv1.setText(di.episode.toUpperCase(Locale.FRENCH));
        tv2.setText("S"+di.season_n+"E"+di.episode_n);
        tv3.setText(di.part);
         
        return v;
		
		
		
	}

}